package amdocs.jet.pm.safenote.common;

import java.io.Serializable;
import java.util.ArrayList;
import java.util.List;

public class SafeNoteList implements Serializable {

    private static final long serialVersionUID = 1L;

    private List<SafeNote> safeNotelist = new ArrayList<SafeNote>();
    
    public SafeNoteList() {
    }

    public SafeNoteList(List<SafeNote> safeNotelist, String safeNoteOwner, String safeNoteName, String safeNoteIcon,
    		String safeNoteCategoryName, String safeNoteBody) {
        super();
        this.safeNotelist = safeNotelist;
    }

	public List<SafeNote> getSafeNotelist() {
		return safeNotelist;
	}

	public void setSafeNotelist(List<SafeNote> safeNotelist) {
		this.safeNotelist = safeNotelist;
	}
	
	public void addSafeNote(SafeNote safeNote)
	{
		safeNotelist.add(safeNote);
	}
	public boolean removeSafeNote(SafeNote iSafeNote)
	{
		for (SafeNote safeNote : safeNotelist) 
		{
			if (safeNote.getSafeNoteID().equals(iSafeNote.getSafeNoteID()))
			{
				safeNotelist.remove(safeNote);
				return true;
			}
		}
		return false;
	}
	
	public void updateSafeNote(SafeNote iSafeNote)
	{
		if (removeSafeNote(iSafeNote))
		{
			safeNotelist.add(iSafeNote);
		}
	}
}
